from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait

from page_objects.base_page import BasePage
from utils.click_expect import click_expection


class CategoryCreatPage(BasePage):
    _MENU_NAME_ = (By.CSS_SELECTOR, ".el-input__inner")
    '''创建类目页面：创建类目'''
    def creat_category(self,test_name= None):
        # 输入‘类目名称’
        self.do_find(self._MENU_NAME_).send_keys(test_name)
        # 点击‘确定’按钮
        ele = (By.CSS_SELECTOR, ".dialog-footer .el-button--primary")
        WebDriverWait(self.driver, 10).until(click_expection(*ele))
        # ==》类目列表页面
        from page_objects.category_list_page import CategoryListPage
        return CategoryListPage(self.driver)